﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Kosmos
{
    /// <summary>
    /// This screen alows the player to choose the level he wants to play.
    /// </summary>
    class LevelMenuScreen : MenuScreen
    {
        #region Initialization


        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public LevelMenuScreen(): base("Level Menu",false)
        {
            // Create our menu entries.
            MenuEntry level1MenuEntry = new MenuEntry("Level 1");
            MenuEntry level2MenuEntry = new MenuEntry("Level 2");
            MenuEntry level3MenuEntry = new MenuEntry("Level 3");
            MenuEntry backMenuEntry = new MenuEntry("Back");

            // Hook up menu event handlers.
            level1MenuEntry.Selected += Level1EntrySelected;
            level2MenuEntry.Selected += Level2EntrySelected;
            level3MenuEntry.Selected += Level3EntrySelected;
            backMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(level1MenuEntry);
            MenuEntries.Add(level2MenuEntry);
            MenuEntries.Add(level3MenuEntry);
            MenuEntries.Add(backMenuEntry);
        }

        #endregion

        #region Handle Input


        /// <summary>
        /// Event handler for when the Play Game menu entry is selected.
        /// </summary>
        void Level1EntrySelected(object sender, PlayerIndexEventArgs e)
        {
            LoadingScreen.Load(ScreenManager, true, 1, e.PlayerIndex);
        }


        /// <summary>
        /// Event handler for when the Options menu entry is selected.
        /// </summary>
        void Level2EntrySelected(object sender, PlayerIndexEventArgs e)
        {
            LoadingScreen.Load(ScreenManager, true, 2, e.PlayerIndex);
        }

        /// <summary>
        /// Event handler for when the Options menu entry is selected.
        /// </summary>
        void Level3EntrySelected(object sender, PlayerIndexEventArgs e)
        {
            LoadingScreen.Load(ScreenManager, true, 3, e.PlayerIndex);
        }
        
        #endregion
    }
}
